
const app = getApp();
const util = require('./util')
var Url = new util.Url()

// 更新用户信息 
export const _update_userinfo = (data, cb) => {
  app.post('/member/wechat/update_userinfo/', data, cb)
}
// 绑定手机号
export const _bind_phonenumber = (data, cb) => {
  app.post('/member/wechat/bind_phonenumber/', data, cb)
}

// 获取区域信息
export const _get_area = (params, cb) => {
  let url = Url.getUrl('/member/system/area/', params)
  app.get(url, {}, cb)
}
// 保存商铺信息
export const _save_store = (data, cb) => {
  // let url = record ? '' : '/member/store/' + data.id + '/'
  // let method = record ? 'post' : 'PUT'
  // console.log(url, method)
  app.post('/member/store/', data, cb)
}
// 获取商铺信息
export const _get_store = (params, cb) => {
  let url = Url.getUrl('/member/store/mine/', params)
  app.get(url, {}, cb)
}
// 删除商铺
export const _del_store = (id, cb) => {
  let url = '/member/store/' + id + '/'
  app.delete(url, cb)
}
// 获取活动列表
export const _get_activities = (params, cb) => {
  let url = Url.getUrl('/member/activity/list/', params)
  app.get(url, {}, cb)
}
// 我创建的活动
export const _get_mine_create_activities = (params, cb) => {
  let url = Url.getUrl('/member/activity/mine_create/list/', params)
  app.get(url, {}, cb)
}
// 获取活动详情
export const _get_activity_detail = (id, cb) => {
  let url = '/member/activity/' + id + '/detail/'
  app.get(url, {}, cb)
}

// 收藏活动
export const _collect_activity = (id, cb) => {
  let url = '/member/activity/' + id + '/collect/'
  app.get(url, {}, cb)
}

// 获取报名投票活动的成员列表
export const _get_member_apply_vote_list = (id, params, cb) => {
  let url = '/member/activity/vote/apply/list/?activity=' + id
  app.get(url, params, cb)
}

// 获取报名投票活动的成员列表Top20
export const _get_member_vote_apply_rank_top = (id, top, cb) => {
  let url = '/member/activity/vote/apply/rank_top/?activity_id=' + id + '&top=' + top
  app.get(url, {}, cb)
}

// 活动的商铺信息
export const _store_info = (id, cb) => {
  let url = '/member/activity/' + id + '/store_info/'
  app.get(url, {}, cb)
}

// 报名投票活动
export const _apply_vote_activity = (data, cb) => {
  let url = '/member/activity/vote/apply/'
  app.post(url, data, cb)
}
// 获取投票详情信息
export const _apply_vote_info = (data, cb) => {
  let url = '/member/activity/vote/apply/detail/'
  app.get(url, data, cb)
}

// 投票
export const _vote = (data, cb) => {
  let url = '/member/activity/vote/'
  app.post(url, data, cb)
}

// 关注店铺
export const _focus_store = (id, cb) => {
  let url = '/member/store/' + id + '/focus/'
  app.get(url, {}, cb)
}

// 报名砍价活动
export const _apply_bargain_activity = (activity_id, cb) => {
  let url = '/member/activity/' + activity_id + '/bargain/apply/'
  app.post(url, {}, cb)
}
// 帮砍加
export const _bargain = (activity_id, data, cb) => {
  let url = '/member/activity/' + activity_id + '/bargain/'
  app.post(url, data, cb)
}

// 帮砍加记录（有问题）
export const _apply_bargain_record = (activity_id, data, cb) => {
  let url = '/member/activity/' + activity_id + '/bargain/record/'
  app.get(url, data, cb)
}
// 砍价报名信息
export const _apply_bargain_info = (activity_id, apply_id, cb) => {
  let url = '/member/activity/' + activity_id + '/bargain/apply/' + apply_id + '/'
  app.get(url, {}, cb)
}
// 砍价活动报名列表
export const _apply_bargain_list = (activity_id, data, cb) => {
  let url = '/member/activity/' + activity_id + '/bargain/apply/list/'
  app.get(url, data, cb)
}


// 我报名的活动
export const _mine_apply_activities = (data, cb) => {
  let url = '/member/activity/mine/apply/'
  app.get(url, data, cb)
}

